$(function () {
    $.ajax({
        //几个参数需要注意一下
        type: "POST", //方法类型
        dataType: "json", //预期服务器返回的数据类型
        url: "../../tourist/getAllTourist", //url
        data: {},
        success: function (result) {
            if (result.code != 0) {
                layer.msg(result.msg);
            } else {
                var optionstring = "<option value=\"" + 0 + "\" >请选择</option>";
                for (var j = 0; j < result.data.length; j++) {
                    optionstring += "<option value=\"" + result.data[j].id + "\" >" + result.data[j].tourist_name + "</option>";
                }
                $("#tourist").html(optionstring);
                initSelect();
            }
        },
        error: function () {
            layer.msg("网络异常,请稍候重试！");
        }
    });

    function initSelect() {
        layui.use('form', function () {
            var form = layui.form;
            form.render();
        });
    }
})
function submitInfo() {
    $.ajax({
        type: "POST",
        url: "../../toilet/addToilet",
        data: {
            "cate_name":$("#longitude").val(),
        },
        dataType: "json",
        success: function(data){
            if(data.code==0){
                layer.alert('添加成功', {
                    skin: 'layui-layer-molv' //样式类名
                    ,closeBtn: 0
                }, function(){
                    window.location.reload();
                });
            }else{
                layer.msg(data.msg);
            }
        }
    });
}